/*package com.acmedcare.framework.exchange.center.core.storage;

import com.acmedcare.framework.boot.snowflake.Snowflake;
import com.acmedcare.framework.exchange.center.entity.bean.SchedulerType;
import com.acmedcare.framework.exchange.center.entity.bean.Task;
import com.acmedcare.framework.exchange.center.entity.dto.TaskStatusEnum;
import com.acmedcare.framework.exchange.center.entity.dto.TaskTypeEnum;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

@Component("taskRepository")
public class TaskRepository {

  private final JdbcTemplate jdbcTemplate;

  private final Snowflake snowflake;

  public TaskRepository(JdbcTemplate jdbcTemplate,
      Snowflake snowflake) {

    this.jdbcTemplate = jdbcTemplate;
    this.snowflake = snowflake;
  }

  public Task getTaskById(Long taskId) {

    return jdbcTemplate
        .queryForObject("SELECT * FROM center_task WHERE task_id=?", new Object[]{taskId},
            new TaskRowMapper());
  }

  public void updateExecuteTime(Date lastExecuteTime, Long taskId) {

    String sql = " UPDATE  center_task SET last_run_time=? WHERE task_id=?";
    jdbcTemplate.update(sql, new Object[]{lastExecuteTime, taskId});
  }

  public void updateStatus(String status, Long taskId) {

    String sql = "UPDATE center_task SET `status`=? WHERE task_id=?";
    jdbcTemplate.update(sql, new Object[]{status, taskId});
  }

  class TaskRowMapper implements RowMapper<Task> {

    @Override
    public Task mapRow(ResultSet resultSet, int i) throws SQLException {
      Task task = new Task();
      task.setTaskId(resultSet.getLong("task_id"));
      task.setDependJar(resultSet.getString("depend_jar"));
      task.setName(resultSet.getString("name"));
      task.setExecuteMainClass(resultSet.getString("execute_main_class"));
      task.setExecuteCron(resultSet.getString("execute_cron"));
      task.setExecuteJar(resultSet.getString("execute_jar"));
      task.setType(TaskTypeEnum.valueOf(resultSet.getString("type")));
      task.setStatus(TaskStatusEnum.valueOf(resultSet.getString("status")));
      task.setSchedulerType(SchedulerType.valueOf(resultSet.getString("scheduler_type")));
      task.setDescription(resultSet.getString("description"));
      task.setVersion(resultSet.getString("version"));
      task.setJarName(resultSet.getString("jar_name"));
      return task;
    }
  }
}*/
